package strcy.cn.market.mapper;

import org.apache.ibatis.annotations.*;
import strcy.cn.market.pojo.ProductCategories;

import java.util.List;

@Mapper
public interface ProductCategoryMapper {
    //新增分类
    @Insert("insert into product_categories(category_name, create_time, update_time,description) " +
            "value(#{categoryName},NOW(),NOW(),#{description})")
    void add(ProductCategories productCategories);
    //更新分类名
    @Update("update product_categories set category_name=#{categoryName} ,update_time=NOW() where category_id=#{categoryId} ")
    void update(ProductCategories productCategories);
    //根据分类ID删除分类
    @Delete("delete from product_categories where category_id=#{id}")
    void deleteById(Integer id);
    //获取分类列表
    @Select("select * from product_categories")
    List<ProductCategories> list();
}
